package slap.http;

public class StatusCode {

    public static final int OK = 200;
    public static final int CREATED = 201;
    public static final int ACCEPTED = 202;
    public static final int PARTIAL_INFO = 203;
    public static final int NO_RESPONSE = 204;
    public static final int MOVED = 301;
    public static final int FOUND = 302;
    public static final int METHOD = 303;
    public static final int NOT_MODIFIED = 304;
    public static final int BAD_REQUEST = 400;
    public static final int UNAUTHORIZED = 401;
    public static final int PAYMENT_REQUIRED = 402;
    public static final int FORBIDDEN = 403;
    public static final int NOT_FOUND = 404;
    public static final int INTERNAL_ERROR = 500;
    public static final int NOT_IMPLEMENTED = 501;
    public static final int OVERLOADED = 502;
    public static final int GATEWAY_TIMEOUT = 503;

    public static boolean success(int code) {
        return code / 100 == 2;
    }

    public static boolean redirect(int code) {
        return code / 100 == 3;
    }

    public static boolean error(int code) {
        return code / 100 == 4 || code / 100 == 5;
    }
}